<template>
  <div class="app">
    <div>{{ str }}</div>
    <button @click="changeStr">changeStr</button>
    <button @click="addArr">addArr</button>
    <p
      v-for="item in arr"
      :key="item"
    >
      {{ item }}
    </p>
  </div>
</template>
<script>
import { ref } from 'vue'
export default {
  setup() {
    const str = ref('hello vue3')
    const arr = ref([1, 2])

    const changeStr = () => {
      str.value = '更新了'
    }

    const addArr = () => {
      // arr.value.push(Date.now())
      arr.value = [...arr.value, Date.now()]
    }
    return {
      str,
      changeStr,
      arr,
      addArr
    }
  }
}
</script>
<style lang="scss" scoped></style>
